/*
 * BillType.java
 *
 * Created on 24 de Junho de 2007, 15:47
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.unifor.epayment.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

/**
 * Entity class BillType
 * 
 * @author adm
 */
@javax.persistence.Entity
@NamedQueries( {
        @NamedQuery(name = "BillType.findById", query = "SELECT obj FROM BillType obj WHERE obj.id = :id"),
        @NamedQuery(name = "BillType.findByName", query = "SELECT obj FROM BillType obj WHERE obj.name = :name"),
        @NamedQuery(name = "BillType.findAll", query = "SELECT obj FROM BillType obj WHERE obj.status = '1'")
    })
public class BillType implements Serializable {

    @javax.persistence.Id
    @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.AUTO)
    private Long id;
    
    @Column(name = "TYPENAME", nullable = false)
    private String name;
    
    @Column(name = "DESCRIPTION", nullable = false)
    private String description;
    
    @Column(name = "STATUS", nullable = false)
    private char status;  
    
    /** Creates a new instance of BillType */
    public BillType() {
    }
    
    public BillType(Long id, String name, String description, char status) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.status = status;
    }

    /**
     * Gets the id of this BillType.
     * @return the id
     */
    public Long getId() {
        return this.id;
    }

    /**
     * Sets the id of this BillType to the specified value.
     * @param id the new id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Returns a hash code value for the object.  This implementation computes 
     * a hash code value based on the id fields in this object.
     * @return a hash code value for this object.
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    /**
     * Determines whether another object is equal to this BillType.  The result is 
     * <code>true</code> if and only if the argument is not null and is a BillType object that 
     * has the same id field values as this object.
     * @param object the reference object with which to compare
     * @return <code>true</code> if this object is the same as the argument;
     * <code>false</code> otherwise.
     */
    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BillType)) {
            return false;
        }
        BillType other = (BillType)object;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
        return true;
    }

    /**
     * Returns a string representation of the object.  This implementation constructs 
     * that representation based on the id fields.
     * @return a string representation of the object.
     */
    @Override
    public String toString() {
        return "br.unifor.epayment.entity.BillType[id=" + id + "]";
    }

    /**
     * Gets the name of this BillType.
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name of this BillType to the specified value.
     * @param name the new name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Gets the description of this BillType.
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the description of this BillType to the specified value.
     * @param description the new description
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * Gets the status of this BillType.
     * @return the status
     */
    public char getStatus() {
        return status;
    }

    /**
     * Sets the status of this BillType to the specified value.
     * @param status the new status
     */
    public void setStatus(char status) {
        this.status = status;
    }
    
}
